import { activeRouter, constantRoutes } from '@/router/index'
const state = {
  routers: []
}
const mutations = {
  // 更爱渲染的侧边栏
  setRouterList(state, menus) {
    state.routers = [...constantRoutes, ...menus]
  }
}
const actions = {
  fileRouter(store, menus) {
    // 判断有没有权限
    const res = activeRouter.filter(item => menus.indexOf(item.name) !== -1)
    store.commit('setRouterList', res)
    return res
  }
}
export default {
  namespaced: true,
  state,
  actions,
  mutations
}
